<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <script src="js/jquery-3.2.1.min.js"></script>
</head>
<body>
<input type="text" class="username"><br>
<input type="text" class="password"><br>
<input type="button" class="login" value="登录">
<input type="button" class="register" value="注册">
<div class="div1">

</div>
<script>
    $(".register").click(function () {
        location.href = "register.html";
    })
    $(".login").click(function () {
        var username = $(".username").val();
        var password = $(".password").val();
        $.ajax({
            url:"http://47.104.87.243:8081/login",
            type:"get",
            data:{
                username:username,
                password:password
            },
            success:function (re) {
                if (re.code === 1000) {
                    alert("登陆成功");
                    location.href = "paging.html";
                }else if (re.node === 1007) {
                    alert(re.msg);
                }
            }
        })
    })
</script>
</body>
</html>